# 设备管理页面测试
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class DeviceManager(KeyWords):
    url = KeyWords.url + 'worksite/device-management'

    def create_device(self):
        '''
        现建设备
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\device_manage\device_create.yaml')
        element_operation(self, data[0]['data'])
        return data[1]['assert_dict']

    def device_update_delete(self):
        '''
        现建设备
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\device_manage\device_update_delete.yaml')
        element_operation(self, data[0]['data'])
        return data[1]['assert_dict']


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobeAdmin002', 'kobe8888')
        case = DeviceManager(driver)
        case.device_update_delete()
    except Exception as e:
        driver.quit()
        raise e
    else:
        driver.quit()
